﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ExceptionExtension.cs" company="">
//   
// </copyright>
// <summary>
//   The exception extension.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace UITest.CUIT.CuitControls.Extension
{
    using System;
    using System.Text;

    /// <summary>
    ///     The exception extension.
    /// </summary>
    public static class ExceptionExtension
    {
        #region Public Methods and Operators

        /// <summary>
        /// The extension full message.
        /// </summary>
        /// <param name="ex">
        /// The ex.
        /// </param>
        /// <returns>
        /// The <see cref="string"/>.
        /// </returns>
        public static string ExtensionFullMessage(this Exception ex)
        {
            var builder = new StringBuilder();
            while (ex != null)
            {
                builder.AppendFormat("{0}{1}", ex.Message, Environment.NewLine);
                ex = ex.InnerException;
            }

            return builder.ToString();
        }

        #endregion
    }
}